Solution for abs method