Added tooltip function functionality, fixed various bugs. Code needs to be compacted a bit, too many ifs.