some better names and nicer indentation