functionalization

functionalized everything, ordered logically, cleaned up code
check earlier commits for progress on zooming