Fixed minor bugs and removed unnecessary lines.
Moved from events to callbacks and from restler to request.