Implementation of some operation and code clenup