These two methods is very similiar. Could that be refactored?