Refactor for simpler functions
Use strict, change scope to context