Some refactoring.
Replaced context things with functions binds.