fixed function messy due to prev bug
bit of comment cleanup, lots of fixes todo