Made the code neater and created a multui threaded server class