Made some much needed changes. Now most things work as intended. Except
for a few bugs that have been highlighted. :P