Implemented a more robust avatar hand movement system in main.cpp