screwed up checks for beggining and end to port to AWS