added defined array size and cleaned up some code

Defined the array size with max number of sensors and cleaned up power
saving delay code. Also improved documentation throughout the program.