multiple conditionals

Finished and cleaned up code.