cleaned up perl