Cleaning up bugs etc