made code dynamically with difines