refactored js into files, added cookie command cache