code optimization
added parameters to constructor