Fixed: Removed test function
Fixed: Reorganized JS code