Added missing curly brace to allow final conditional to run