Removed some not needed checks, reorganized a bit.