Add process method and clean up code