cleaned up coffee script, bug fixes