adding initial code derived from plastik-rock along with some library functions