made import error handling explicit
refactored server code for readability and reuse
Merge pull request #16 from BorisVerk/master

server refactor