D-15753 added functiona tests and change logic to check without hard coded :/
reformatted code
Merge pull request #760 from rackerlabs/D-15753

D-15753 added functional tests and change logic to check without hard coded logic