Refactored typer.js