Refactored. Added session, server classes.