Added prepend function, coupls small bug fixes