Made code less, spaghetti like... Also optimized and fixed "null" bug

Signed-off-by: NullAmbitions <NullAmbitions@gmail.com>