updated js c

much cleaner