cleaned things up and added more inputs