Cleaned JS code

Closed #35
Started on #36