Tidying up code. Fixed screen wrap to work in both directions.