Added missing type signatures and reorganized