Code reformatted with astyle