changed redstone code completely to Howaner's version. Also added
Doxygen code for new function.