C-IPS: A smartphone based indoor positioning system