fixed update

bug fixes, cleaning up code