Moved type declaration to the top and more TODO