Tested code, some minor stuff