small refactors. Chain of handlers has been implemented