Added some misc optimizations

Signed-off-by: Sultan <sultanxda@gmail.com>