Many bugfixes, added better output feature