Cleaned copypasted piece of code