First major commit, added most js functionality