Clean up code

Directly include base64-js methods to remove dependency

Port to AMD module