Finishing the main implementation