Fixed 90% of the bugs. Fully functional

All functional bugs were fixed. Only need to fix log file entries and
find a new way to terminate the threads in order to prevent a flood of
messages.