Rearrange code, create static methods, documentation