Bug fixing / general improvement