wip
corrected array splice function