Changes requested in review:

1) Improved comments and formatting
2) Removed unused callbacks
3) Used library circular modulus function