Did some minor changes, fixed docblocks and replaced a deprecated function.