Improved performance

Fix #353