Cleaned up code fixed validation