main: Remove obsolete code

Change-Id: I6e32e6a649e454bd3560d06e6f27b74c15a680bd
main: Avoid usage of global static variables when possible

Change-Id: Iaaad7ad115e5508ff4f4ce8ce3b28678e33bb509