Using a better JS code style and adding some things