Feature 9, 28, 30, 33

Implementation of feature 9, 28, 30, 33 and various bug fixes