adding started parameters and cleaned up code