use touchwin instead of mvwin and this doesn't need its own function