Cleaned up coffee script, bug fixes