major restructuring for better workflow