sin calcultion conditions fixed from lots of "if"'s to else