Changed return types and moved it to types.h