Refactoring server side - part 2

Modifying callback structures and anonymous functions