solutions up to problem 6 + some extra functions