refactored logic to server.py
made test reflect refactor

initial attmpts to test server logic did not go well
minor fixes
fixed array access
Merge pull request #63 from BorisVerk/master

refactored logic to server.py