Working do_in and length, much cleaner code now