cleaned up conditionals, updated tests