improved heartbeats

scratched the sleep() in the loop and replaced it with a scheduler
small formatting changes

reordered some methods in SocketHandler, made methods that shouldnt be
final not final, etc etc