added UI part, also refactored server part