Removed the unnecessary assertion failure. Cleaned up the code