Added varying sizes & refactored update function