Initial implementation of main