Modifications

Made some changes to the code, mostly for the sake of optimization.