Added position updating and fixed minor bugs.