Center Function Implemented and other bug fixes