Moving logic where i think it belongs to