modify a lot of functions to work faster

Signed-off-by: portamx <support@portamx.com>