Rewrite it in more ruby and understandable way
Remove swp