add username param everywhere in lib/main.js
fix lib/main and its tests