remove duplicate of code (cleanup is already done later in nicer way)