add multiple operations functionality and clean up code