Fixed bug and added module API