fixed error and improved arrangement