Serial algorithm implemented; though there are bugs