the basics work now
more functionality and cleaner javascript