changed memory allocation of internal objects still has to be improved