Documentation

Added more thorough inline documentation