code formatted with astyle - great tool