code refactoring

code refactoring for lisibility and for lisibility and agc unit test
added for Fixed memory switch.