made the accept and handle code reusable and moved it to common