Finalised tracking code. Close #5