Tried to optimize the codebase slighty