Fixed syntax error in library, and rewrote a bit