Fixed null character bug, decreased time efficiency though.