converted JS to coffeescript and added encryption/decryption