Removed ugly logic