finished hw implementation