Improved tracking and some bug fixes