Added tests for speedup and some minor changes on code formating