modularized js for testing purposes