Various perf and functionality improvements

Signed-off-by: Ozan Turgut <ozanturgut@gmail.com>