Updated MainFunction

- Added handler and server.methods()