removed unnecessary swap image function